<template>
	<div>
		<div class="main">
			<div id="text1" style="position: absolute; top: 160px; left: 300px;color: white;">
				<br>
				<p>
					<h1 style="z-index: 7; height: 50px;text-align: left;"  class="h_head">疯狂原始人2</h1>
					<h1 style="z-index: 7; height: 40px;text-align: left">The Croods 2</h1>
					<!-- <p style="z-index: 7; height: 30px;text-align: left; line-height: 30px; color: rgb(225, 161, 90);">'红海''湄公河'金牌班底全新力作</p> -->
					<p style="z-index: 7; height: 30px;text-align: left">96分钟 - 喜剧/动画/冒险</p>
					<p style="z-index: 7; height: 30px;text-align: left">2020年11月27日</p>
					<p style="z-index: 7; height: 30px;text-align: left">IMAX3D/2D/3D/中国巨幕3D</p>
				</p>
				<div style="width: 280px; height: 400px; position: absolute;top: -30px; left: 700px;">
					<img src="../../images/035.jpg" alt="">
				</div>
			</div>
			<el-button type="info" plain style='position: absolute; top: 400px; left: 300px;' @click='goumai'>200积分购买</el-button>
		</div>
		<div class="main1">
			<ul>
				<li>
					<h2>剧情：</h2>
					<p style="width: 400px;">
						克罗德家族受到了另一个家族贝特曼家族的挑战，贝特曼家族声称自己更好，进化得更快...
					</p>
				</li>
				<li>

					<h2>导演：</h2>
					<br>
					<p>
						<a href="">

							乔尔·克劳福德</a>
					</p>
					<br>
					<p>
						<a href="">
							Joel Crawford
						</a>
					</p>
				</li>
			</ul>

		</div>
	</div>
</template>

<script>
	import axios from 'axios'
	import store from "../../store/modules/user.js"
	export default {
		data() {
			return {
				user: store.state.user,
				count: store.state.count
			}
		},
		methods: {
			goumai() {
				const us = localStorage.getItem("username");
				const count = this.count;
				console.log(count);
				var value = event.target.innerHTML;
				var value1 = '';
				for (var i = 0; i < value.length; i++) {
					if (value[i] >= '0' && value[i] <= '9') {
						value1 += value[i];
					}
				}
				var name=document.querySelector(".h_head").innerHTML;
				var params = {}
				params["id"] = this.user.id;
				params["count"] = value1;
				params["name"] =name;
				console.log(params);
				var that = this;
				if (this.user.id) {
					axios.post('/user/filmGoumai', params, {
							header: {
								'Content-type': 'application/json;charset=UTF-8'
							}
						})
						.then(function(data) {
								console.log(data);
								alert("购买成功,3秒钟返回首页")
								setTimeout(function() {
									that.$router.push({
										path: "/"
									})
								}, 3000)
							}
			
			
			
						).catch(function(Error) {
							console.log(Error);
						});
				}else {
					alert("没有登录账号，请先登录账号。。。。")
					that.$router.push({
						path: "/index"
					})
				}
			}


		},

		created() {

		}

	}
</script>

<style scoped>
	.main {

		height: 500px;
		background-color: rgb(84, 92, 100);
	}

	.main1 {
		padding-top: 20px;
		width: 1200px;
		margin: 0 auto;
		text-align: left;
		height: 250px;
	}

	.main1 ul li {
		float: left;
		width: 580px;
	}

	img {
		width: 100%;
		height: 100%;
	}
</style>
